#读取视频 #保存视频
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt

video = cv.VideoCapture("F:\\11\\video\\v1.flv")
frame_width=int(video.get(3))
frame_height=int(video.get(4))
def mov():
    while(video.isOpened()):
        ret,frame = video.read()
        if ret==True:
            cv.imshow('frame',frame)
        if cv.waitKey(25)&0xff==ord('q'):
            break
    video.release()
    cv.destroyAllWindows()
def save():
    out=cv.VideoWriter('F:\\11\\video\\outpy.avi',cv.VideoWriter_fourcc('M','J','P','G'),25,(frame_width,frame_height))
    while(True):
        ret,frame=video.read()
        if ret==True:
            out.write(frame)
        else:
            break
    video.release()
    out.release
    cv.destroyAllWindows
if __name__=="__main__":
    mov()
    save()




